//动态导入json数据

var xmlRequest = createXHQ();

xmlRequest.open("GET","../json/buy.json");
xmlRequest.send();

xmlRequest.onreadystatechange=function(){
	
	if(xmlRequest.readyState===4){
		if(xmlRequest.status===200){
			var result1 = xmlRequest.responseText;
			var resultObject = JSON.parse(result1);	
			
			var userLogin = document.getElementById("user");
			if(resultObject.userId!=null&&resultObject.userId!=""){
				userLogin.innerHTML=resultObject.userId;
				userLogin.href="../user_more.html";
			}else{
				userLogin.innerHTML="请登陆";
				userLogin.href="../login.html";
			}
			
			document.getElementsByClassName("nav-t1-left")[0].getElementsByTagName("span")[0].getElementsByTagName("em")[0].innerHTML=resultObject.orderId;
			
			document.getElementsByClassName("nav-t1-right")[0].getElementsByTagName("span")[0].getElementsByTagName("em")[0].innerHTML=resultObject.orderMoney;
			
			document.getElementById("fukuan").getElementsByTagName("span")[1].getElementsByTagName("em")[0].innerHTML=resultObject.userMoney;
			
			document.getElementById("orderForm").onclick=function(){
				window.location.href="../result1/orderForm.html?userId="+resultObject.userId;
			}
		
	}else{
		alert("错误信息："+xmlRequest.status);
		}
	}
}



window.onload=function(){
	
	var a;
	document.getElementById("zhifu-pas").onkeyup=function(){
		var zhifupas = document.getElementById("zhifu-pas").value;
	
		a = varfiyZhifuP(zhifupas);
	}
	
	document.getElementById("ok").onclick=function(){
		
		if(a){
			var XmlRequest = createXHQ();
			
			XmlRequest.open("GET","haha&zhifu-pas=" +document.getElementById("zhifu-pas").value);
			
			XmlRequest.send();
			
			XmlRequest.onreadystatechange=function(){
			
				if(XmlRequest.readyState===4){
					if(XmlRequest.status===200){
						var responseT = XmlRequest.responseText;
						
						var results = JSON.parse(responseT);
						
						alert(results);
						
						
					}else{
						alert("出现错误代码："+XmlRequest.status);
					}
				}
			
			}
			
		}else{
			alert("支付密码填写有误，请重新填写");
		}
		
	}
	
}